home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / WINDOWS / LZAPI.ZIP / LZAPI0.ZIP / LZAPI.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-06  |  9.5 KB  |  242 lines

  1. /*----------------------------------------------------------------------*
  2.  *                                                                      *
  3.  *            L Z A P I . H                    *
  4.  *                                    *
  5.  * Include File for LZW-Archiver/Unarchiver-DLLs included in the LZAPI  *
  6.  * DLL-System                                *
  7.  *                                    *
  8.  * (C) 1996                                                             *
  9.  *    Dipl. Ing. Bernd Herd                                           *
  10.  *    Rodulf-Virchow-Str. 8                                           *
  11.  *    68742 BBⁿrstadt                                                 *
  12.  *    Tel. 06206/79222                                                *
  13.  *      EMail: herdsoft@aol.com                                         *
  14.  *                                                                      *
  15.  *                                                                      *
  16.  *                                                                      *
  17.  *----------------------------------------------------------------------*/
  18.  
  19. /* Purpose of LZAPI:
  20.    Included in the LZAPI-Package are several Packer/Unpacker-DLLs:
  21.    WLHA.DLL        LZH Unpacker/Packer
  22.    WUNZIP.DLL        ZIP Unpacker
  23.    WZIP.DLL             ZIP Packer
  24.    WARC.DLL        ARC Packer/Unpacker
  25.    WUNARJ.DLL        ARJ Unpacker
  26.  
  27.    LZAPI is a Common API-Definition for all this packers that make them
  28.    all the same in the Calling Convention Usage.
  29.  
  30.    Each packer DLL has it's own more powerfull API Functionality, but
  31.    for LZAPI all of them support at least:
  32.  
  33.    XXXList(LPLACTL)    : Copy a Listing of the Archives Contents into
  34.               a Specified Memory Block
  35.  
  36.    XXXExtract(LPLACTL)    : Extract one or more Files
  37.  
  38.    XXX is a Placeholder for the Archiv-Type, that Means LZH/ZIP/ARJ/ARC
  39.  
  40.    The LZAPI.DLL will add to this Functionality the Automatic determination, wich
  41.    Library will actually needed to analyze a given File, which is especially
  42.    interesting with Self-Extracting Archives. It will also look if the DLL
  43.    currently wantet is in fact Available.
  44.  
  45.    All the Informations are exchanged with the help of an Control-Block
  46.    Structure, because it makes Dynamic Linking via "LoadLibrary" much easier.
  47.  
  48. */
  49.  
  50. #ifdef WIN32
  51. # define ISVERSION20ORLATER(lpCtl) (TRUE)
  52. #else
  53. # define ISVERSION20ORLATER(lpCtl) (lpCtl->lStructSize > 42)
  54. #endif
  55.  
  56.  
  57. // -------------- Standard stuff -------------------------
  58. #ifndef __LZAPI_H
  59. #define __LZAPI_H
  60.  
  61. #ifdef __cplusplus
  62. extern "C" {
  63. #endif
  64.  
  65.  
  66. // ----------- Error Codes Definition --------------------
  67. typedef int LAERR;
  68.  
  69. #define LAE_OK            0        // No Error occured
  70. #define LAE_ARCHIVNOTFOUND      2020        // Archiv File not Found
  71. #define LAE_BROKEN              2021        // Broken Archiv
  72. #define LAE_WRITE        2023        // Error while creating or writing destination File.
  73. #define LAE_CRC                 2024            // CRC error
  74. #define LAE_INSTANCE        2026            // Instanz-Handling-Error (i.e. tried to run more than one Process)
  75. #define LAE_INFILENOTFOUND      2027            // Input File not found
  76. #define LAE_STOPPED             2028            // Stopped by Callbac-Routine
  77. #define LAE_WRONGTYPE           2029        // Wrong Type of File
  78. #define LAE_DLLMISSING        2030        // Dll missing or errornous
  79. #define LAE_DOSBOX        2051        // Problem while executine a DOS-Box occured
  80. #define LAE_TEMPORARY        2052        // Error while renaming or deleting temporary File
  81. #define LAE_PARAMETERS        2053        // Illegal Parameters (i.e. lpstrListing NULL during LAList)
  82. #define LAE_MEM            2054        // Virtual memory exhausted
  83.  
  84. // ----------- Flag-Value Definitions --------------------
  85. #define LAF_SHORTNAMES        0x200        // Recommended Option to Supress usage of Long Filenames
  86. #define LAF_ALLOWGROWEXIST    0x400        // Allow Grow of existing Archiv (No Copy will be Done)
  87.                         // Currently supportd by WZIP only.
  88. #define LAF_RECURSEINTO        0x800        // Recurse into Subdirectorys during Archiv Creation (Supported by ZIP only)
  89.  
  90.  
  91. // ------- Archiver Type Codes ---------- ----------------
  92. // Return values for "LAIsArchiv" and "ArchiverType"-Field of LACTL-Structure
  93. #define TY_NONE 0
  94. #define TY_LZH  1
  95. #define TY_ARC  2
  96. #define TY_ARJ  3
  97. #define TY_ZIP  4
  98. #define TY_RAR  5
  99. #define TY_TAR  6
  100. #define TY_ZOO  7
  101.  
  102.  
  103. // ----------- Define Control Structure ------------------
  104. typedef struct tagLACTL {
  105.     DWORD    lStructSize;        // Length of the Control Structure in Bytes
  106.     HWND    hwndOwner;        // Handle of the Parent Window (Needed for Message-Boxes etc.)
  107.  
  108.     LPCSTR    lpstrArchivFile;    // Points to a Buffer that specifies the Name of the Archiv File
  109.     LPCSTR    lpstrWildcards;        // Points to a Buffer that specifies the File-Names to be listet or
  110.                     // Extracted, like "*.*" or "*.DOC", or NULL for ANY FILE
  111.     LPCSTR    lpstrPath;        // Points to a Buffer that specifies the destination Pathname
  112.                     // for the extracted Files (for Example C:\\TMP)
  113.     DWORD    Flags;            // Some LA_xxxx - Flags, combined via | - Operator
  114.  
  115.     LAERR (CALLBACK* lpfnCallback)(int, struct tagLACTL far *);    // Callback-Routine to support "Multitasking".
  116.  
  117.     // -------- Listing-Function only ------------------------
  118.     LPSTR    lpstrListing;        // Points to a Buffer that shall receive the Directory Listing
  119.  
  120.     // -------- Application-Reserved Fields ------------------
  121.     LPARAM    lParam;            // These Fields may be used freely by the application Program
  122.     void FAR*lpVoid;
  123.     short   iCounter;
  124.  
  125.     // -------- New in Version 1.3 ---------------------------
  126.     short   ArchiverType;        // TY_xxxx- Constant to select an Archiver-Type LZAPI shall use
  127.                     // (TY_NONE for auto-Selection)
  128.  
  129.     // -------- New in Version 2.0 ---------------------------
  130.     LPCSTR  lpstrProcessedFile;        // File that is currently processed inside of the Archiv
  131.     UINT    uPercentOfFile;        // Percentage of file processed at LAM_PERCENTOFFILE         - Message
  132.     UINT    uPercentOfArchiv;    // Percentage of file processed at LAM_NEXTFILE/LAM_MAPNAME - Message
  133.  
  134.     DWORD   Reserved[10];        // Reserved for futire use, must be all zero
  135.  
  136.     } LACTL, FAR *LPLACTL;
  137.  
  138.  
  139. void FAR PASCAL LAErrMsg( LAERR errId, LPLACTL Ctl );
  140.     // Displays a message-Box with an error-Message informing the User
  141.     // what happened
  142.  
  143.  
  144. // ----------- Callback-Procedure template ---------------
  145. typedef LAERR (CALLBACK* LACALLBACK)(int, LPLACTL);    // Type declaration Callback-Function
  146.  
  147. //----------- Callback Routine Messages ------------------------------
  148. #define LAM_PEEK          1             // Nothing special
  149. #define LAM_NEXTFILE      2             // Start processing next File                      (Only handled by SOME Archivers)
  150. #define LAM_PERCENTOFFILE 3        // Transfer of %-Value of file processed in Archiv (Only handled by SOME Archivers)
  151. #define LAM_MAPNAME      4        // Allow to change name of File (in lpstrProcessedFile) before unzipping (WUNZIP.DLL)
  152.  
  153.  
  154. //------------- Callback-Notification-Codes -----
  155. #define LAN_OK                   0              // Nothing special
  156. #define LAN_STOP                 2              // Used with LHAM_PEEK     : Stop Decompression of Archive immediatly
  157.  
  158.  
  159. // ----------- Templates for all supported DLLs ----------
  160. LAERR FAR PASCAL LZHList(LPLACTL);
  161. LAERR FAR PASCAL LZHExtract(LPLACTL);
  162. LAERR FAR PASCAL LZHAppend(LPLACTL);
  163. #ifdef WIN32
  164. LAERR FAR PASCAL LZHDelete(LPLACTL);
  165. #endif
  166.  
  167. LAERR FAR PASCAL ZIPList(LPLACTL);
  168. LAERR FAR PASCAL ZIPExtract(LPLACTL);
  169. LAERR FAR PASCAL ZIPAppend(LPLACTL);
  170. LAERR FAR PASCAL ZIPDelete(LPLACTL);
  171.  
  172. LAERR FAR PASCAL ARJList(LPLACTL);
  173. LAERR FAR PASCAL ARJExtract(LPLACTL);
  174.  
  175. LAERR FAR PASCAL ARCList(LPLACTL);
  176. LAERR FAR PASCAL ARCExtract(LPLACTL);
  177. LAERR FAR PASCAL ARCAppend(LPLACTL);
  178. LAERR FAR PASCAL ARCDellete(LPLACTL);
  179.  
  180. LAERR FAR PASCAL ZOOList(LPLACTL);
  181. LAERR FAR PASCAL ZOOExtract(LPLACTL);
  182. LAERR FAR PASCAL ZOOAppend(LPLACTL);
  183. LAERR FAR PASCAL ZOODelete(LPLACTL);
  184.  
  185. typedef LAERR    (CALLBACK* LAPROC)(LPLACTL pCtl);    // Typedef for Pointers to the above Functions
  186.  
  187. // ------------ Archive-Type independend Versions --------
  188. LAERR FAR PASCAL LAList   (LPLACTL lpCtl);        // List Files in archiv
  189. LAERR FAR PASCAL LAExtract(LPLACTL lpCtl);        // Extract Files from Archiv
  190. LAERR FAR PASCAL LAAppend (LPLACTL lpCtl);        // Append Files to Archiv
  191. LAERR FAR PASCAL LADelete (LPLACTL lpCtl);        // Delete Files from Archiv
  192.  
  193. // ------------- Direct Parameter Versions ---------------
  194. LAERR FAR PASCAL LAListDirect(
  195.              HWND   hwndOwner,
  196.              LPCSTR ArchivFile,
  197.              LPCSTR Wildcards,
  198.              LPSTR  Listing,
  199.              DWORD  Flags,
  200.              LACALLBACK Callback);
  201. LAERR FAR PASCAL LAExtractDirect(
  202.              HWND   hwndOwner,
  203.              LPCSTR ArchivFile,
  204.              LPCSTR DestPath,
  205.              LPCSTR Wildcards,
  206.              DWORD  Flags,
  207.              LACALLBACK Callback);
  208. LAERR FAR PASCAL LAAppendDirect(
  209.              HWND   hwndOwner,
  210.              LPCSTR ArchivFile,
  211.              LPCSTR SourcePath,
  212.              LPCSTR Wildcards,
  213.              DWORD  Flags,
  214.              LACALLBACK Callback);
  215. LAERR FAR PASCAL LADeleteDirect(
  216.              HWND   hwndOwner,
  217.              LPCSTR ArchivFile,
  218.              LPCSTR Wildcards,
  219.              DWORD  Flags,
  220.              LACALLBACK Callback);
  221.  
  222.  
  223. // -------------- Support Functions ----------------------
  224. LPCSTR FAR PASCAL LAGetExtensionString(BOOL Compress);
  225.         // Retrieves a String-Pointer to the List of
  226.         // Currently supported extenstions "*.LZH;*.ARJ;*.ZIP;*.ARC" etc.
  227.         // They are usefull for COMMDLG-Filter-Settings
  228. int    FAR PASCAL LAIsArchiv(LPCSTR FileName);
  229.         // Test if the FileName given marks an Archiv that may be
  230.                 // listed or decompressed
  231.  
  232. // -------------- Shareware Registration -----------------
  233. BOOL   FAR PASCAL LARegister(LPCSTR lpszUserName, LPCSTR lpszPassword);
  234.  
  235. // -------------- Standard stuff -------------------------
  236.  
  237. #ifdef __cplusplus
  238. }
  239. #endif
  240.  
  241. #endif // __LZAPI_H
  242.